package controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import dao.Products;
import model.ProductModel;

public class ProductsUser extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) 
					throws ServletException, IOException {
		String action = request.getParameter("action");
		String name= request.getParameter("txtTimkiem");
		HttpSession session = request.getSession();
		if(action.equals("tim")){
			List<ProductModel> rs = new ArrayList<ProductModel>();
			Products productDTO = new Products();
			
			rs = productDTO.getProducts(null, name, null, null);
			session.setAttribute("kqTim", rs);
			response.sendRedirect("Trang_tim_kiem.jsp");
		}
		
	}
}
